package com.school.recuirmentsystem.vo;



public class ResponseResult {

    private int code;

    private String message;

    private Object data;

    public final static int DEFAULT_OK_CODE=200;

    public final static int DEFAULT_ERROR_CODE=500;

    public final static int NOT_AUTHENTICATED =401;

    public final static int NOT_AUTHORIZED = 403;

    public final static int NOT_FOUND_RESOURCE = 40004;

    public final static String DEFAULT_ERROR_MSG = "Error";

    public ResponseResult(int code, String message, Object data) {
        super();
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static ResponseResult build(int code, String message, Object data) {
        return new ResponseResult(code, message, data);
    }

    public static ResponseResult ok() {
        return ok(null);
    }

    public static ResponseResult ok(Object data) {
        return build(DEFAULT_OK_CODE, "OK", data);
    }

    public static ResponseResult error() {
        return error("Error");
    }

    public static ResponseResult error(int code) {
        return error(code, DEFAULT_ERROR_MSG);
    }

    public static ResponseResult error(String message) {
        return error(DEFAULT_ERROR_CODE, message);
    }

    public static ResponseResult error(int code, String message) {
        return build(code, message, null);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return message;
    }

    public void setMsg(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

}


